*** Settings ***
Documentation    TC07-Routing Confirmation FCL
Resource    ../../Keywords/Common_Head.robot
Metadata    Author     Fiona
Metadata    ID    6854003
*** Variables ***
${TenderId}    AUTO 93668
${TenderTitle}    Regress

*** Test Cases ***
TC07-Routing Confirmation FCL
    ${G_TENDERID}    Generate Tender ID
    Set Suite Variable     ${G_TENDERID}
    ${PROJECT}    Copy Dictionary    ${PROJECT_PARAM}
    Set To Dictionary    ${PROJECT}
    ...    TENDER_ID=${G_TENDERID}    TENDER_TITLE=${TenderTitle}    CUSTOEMR_NAME=Miele    CUSTOMER_LEVEL=Global
          ...   MODE=FCL    DEPUTY=NATZHANG    
    Set Suite Variable    ${PROJECT}
    Step 1 User Goes To Basic Data Management Tender List
    Step 2 User Goes To Pricing Collaboration Pricing Project
    Step 3 Input Following Attributes
    Step 4 User Selects Row That Project Name Is 20240815 FCL
    Step 5 Click On Copy Data
    Step 6 Input Tender ID With Value 2024000001 Click On Search
    Step 7 Select This Entry Click On Copy Data Button And Yes In
    Step 8 Select Current Project In Pricing Project Click On
    Step 9 Click Skip Button In Step4 and Yes In The Pop up
    Step 10 User Clicks Next Round Management Button
    Step 11 User Clicks Routing Confirmation Button
    Step 12 User Clicks APAC To Check the Others Uncheck And Clicks
    Step 13 User Clicks NAM To Check and Others Uncheck And Clicks
    Step 14 User Clicks Europe To Check and Others Uncheck And
    Step 15 User Clicks Setup Button
    Step 16 User Clicks Download Button
    Step 17 User Opens The Download File
    Step 18 User Modifies The Value Of The File Some Columns Are
    Step 19 User Uploads The Modified File
    Step 20 User Clicks Ok Button Of The Pop up Dialogue
    Step 21 User Clicks Setup Button And Download Button
    Step 22 User Opens The Download File 2
    Step 23 User Start Round The Project Assignment Are As APAC
    Step 24 Reopen The Dialog Exchange The Current Role To Regional
    Step 25 User Clicks Routing Confirmation Button 2
    Step 26 The Value And Background Color Are As
    Step 27 Click On OK Button
    Step 28 Select APAC Click On Confirm Button And Approve Button
    Step 29 Select APAC Click On Download Check The Downloaded File
    Step 30 Close This Dialog In Round Management Page Download IPT
    Step 31 Login As NATZHANG Open This Project Round Management
    Step 32 Modify It As
    Step 33 Login As WENDJIAN Again Open This Project Round
    Step 34 Close This Window In Round Management Download IPT
    Step 35 Click On Close Button
    Step 36 Select This Project Click On Delete Project Button
    Step 37 User Goes To Basic Data Management Tender List 2



*** Keywords ***
Step ${step} User Goes To Basic Data Management Tender List 
    #************************Step 1******************************
    #  Do:
    #      User goes to Basic Data Management Tender List
    #      Click Create button
    #      Input with following attributes
    #      Tender ID some numbers such as 202408151435001 you can
    #     input with current datetime and some random number to
    #     avoid duplicate validation
    #      Tender Title some value such as Regression Test by
    #     Wendy001
    #      Customer 815 Miele
    #      Mode select all
    #      Level Global
    #      Click on Save button
    #  Expected:
    #      Created successfully with the message Tender has been
    #     added
    #************************************************************
    Login Space
    Create Tender    ${G_TENDERID}     ${TenderTitle}    815    true    true    true

Step ${step} User Goes To Pricing Collaboration Pricing Project
    #************************Step 2******************************
    #  Do:
    #      User goes to Pricing Collaboration Pricing Project
    #      User clicks Create Project button
    #  Expected:
    #      A New Project dialog should be opened successfully
    #************************************************************
    Log    Done in step 3

Step ${step} Input Following Attributes
    #************************Step 3******************************
    #  Do:
    #      Input following attributes
    #      Tender ID 20240815 Regression
    #      Mode FCL
    #      Deadline to TM current date 10 day
    #      Rate Validity From current date
    #      Rate Validity To current date 100 day
    #      Deputies NATZHANG
    #      Description for regression
    #      Click on Save button
    #  Expected:
    #      A new project is created successfully
    #************************************************************
    ${CurDate}    Get Current Date    result_format=%d/%m/%Y
    ${DealLineDate}    Get Current Date    UTC    +10days    result_format=%d/%m/%Y
    ${FutureDate}    Get Current Date    UTC    +100days    result_format=%d/%m/%Y
    Set To Dictionary    ${PROJECT}    DEADLINE_TM_DATE=${DealLineDate}    VALID_FROM=${CurDate}    VALID_TO=${FutureDate}
    Create Project    ${PROJECT}

Step ${step} User Selects Row That Project Name Is 20240815 FCL
    #************************Step 4******************************
    #  Do:
    #      User selects row that project name is 20240815 FCL
    #     Regression
    #  Expected:
    #      The row can be selected successfully
    #************************************************************
    Search Project    ${G_TENDERID}

Step ${step} Click On Copy Data
    #************************Step 5******************************
    #  Do:
    #      Click on Copy Data
    #  Expected:
    #      A dialogue named Copy Target to Project 20240815 FCL
    #     Regression display
    #      Search Criteria
    #      Mode with value FCL uneditable
    #      Customer name with no value
    #      Tender ID with value ALL Editable
    #      Tender Lead with value ALL Editable
    #      RFQ Launch Date with value DD MM YYYY Editable
    #      Search button
    #      Result list has no entry present
    #      Copy Data button is disable now
    #************************************************************
    Copy Data    2024000001    FCL    do not touch me

Step ${step} Input Tender ID With Value 2024000001 Click On Search
    #************************Step 6******************************
    #  Do:
    #      Input Tender ID with value 2024000001 click on Search
    #     button
    #  Expected:
    #      index php attachments get bbed6818 f35c 4750 983e
    #     8bad0a53a928 Result list has one entry as above
    #     information
    #************************************************************
    Log    Done in step 5

Step ${step} Select This Entry Click On Copy Data Button And Yes In
    #************************Step 7******************************
    #  Do:
    #      Select this entry click on Copy Data button and Yes in
    #     pop up window
    #  Expected:
    #      Successfully with messages in pop up window
    #      Tender has been successfully copied from 2024000001 FCL
    #     do not touch me
    #      Please adjust the template and the lanes in Template
    #     Lane Management page if required
    #      After click on OK button
    #      The same message is displayed in Pricing Project page
    #     too
    #************************************************************
    Log    Done in step 5

Step ${step} Select Current Project In Pricing Project Click On
    #************************Step 8******************************
    #  Do:
    #      Select current project in pricing project click on
    #     template management button
    #  Expected:
    #      In the dialog check the information under Step2 should
    #     be the same as project 2024000001 FCL do not touch me
    #************************************************************
    ${project_name}   Set Variable    ${G_TENDERID}-FCL-${TENDER_TITLE}
    Click    xpath = //td[.='${project_name}']
    Sleep    2
    Wait Until Keyword Succeeds    5x    300ms    Click    ${Project_toolbar_TemplateManagementButton}

Step ${step} Click Skip Button In Step4 and Yes In The Pop up
    #************************Step 9******************************
    #  Do:
    #      Click Skip button in Step4 and Yes in the pop up
    #     windown
    #  Expected:
    #      Next Round Management button is enable
    #************************************************************
    Click    ${Template_SkipSendToGPDButton}
    Check Text Value    ${SkipSendToGPDMessage}    Are you sure to skip push pricing?
    Click    ${SkipSendToGPD_Yes}
    Wait Until Keyword Succeeds   60    1    Get Element States    ${Template_NextRoundManagementButton}     contains    visible
    

Step ${step} User Clicks Next Round Management Button
    #************************Step 10******************************
    #  Do:
    #      User clicks Next round management button
    #  Expected:
    #      A dialogue named Project 20240815 FCL Regression Round1
    #     display
    #      We use Automation Tester to login The current role is project
    #     owner
    #      It divides into 5 parts
    #      1 Generation Information current Pricing Round 1
    #     Started 2 lanes
    #      2 Assignment
    #      3 Attached Document
    #      4 Round History
    #      5 The tasks status Region Country My tasks
    #************************************************************
    Wait Until Keyword Succeeds    5x    300ms    Click    ${Template_NextRoundManagementButton}
    Wait For Elements State    //h4/span[contains(text(),"Project ${G_TENDERID}-FCL-${TenderTitle}")]
    Wait For Elements State    //legend[.="Generation Information"]
    Wait For Elements State    //legend[.="Assignment"]
    Wait For Elements State    //legend[.="Attached Document"]
    Wait For Elements State    //legend[.="Round History"]
    Wait For Elements State    //a[.="Region"]
    Wait For Elements State    //a[.="My Tasks"]


Step ${step} User Clicks Routing Confirmation Button
    #************************Step 11******************************
    #  Do:
    #      User clicks routing confirmation button
    #  Expected:
    #      A dialogue named routing confirmation appears
    #      On the top there are three buttons download confirm
    #     setup
    #      The confirm button is gray
    #      There are three checkbox region APAC Europe NAM
    #      The status of the region is not reviewed
    #************************************************************
    Wait For Elements State    ${Project_RoundMgmt_RoutConfirmButton}    enabled    30
    Click    ${Project_RoundMgmt_RoutConfirmButton}
    Wait For Elements State    ${Project_RoundMgmt_Routing_Confirm}    visible    60
    Get Element States    ${Project_RoundMgmt_Routing_Confirm}    contains    disabled
    Wait For Elements State    //td[.="APAC"]
    Wait For Elements State    //td[.="APAC"]/../td[.="Not Reviewed"]
    Wait For Elements State    //td[.="NAM"]
    Wait For Elements State    //td[.="NAM"]/../td[.="Not Reviewed"]
    Wait For Elements State    //td[.="EUROPE"]
    Wait For Elements State    //td[.="EUROPE"]/../td[.="Not Reviewed"]


Step ${step} User Clicks APAC To Check the Others Uncheck And Clicks
    #************************Step 12******************************
    #  Do:
    #      User clicks APAC to check the others uncheck and clicks
    #     download
    #  Expected:
    #      The file can download successfully
    #      Open the file and it has two lanes
    #************************************************************
    Click    xpath=//div//tr[td//text()[contains(.,"APAC")]]//input[@type='checkbox']
    ${filename}    Download File    ${Project_RoundMgmt_Routing_Download}
    Wait Until Keyword Succeeds    3x    500ms    Open Excel Document     ${filename}    ${PROJECT.MODE}
    ${landInfo}    Read Excel Column    1
    ${rowCount}    Get Length    ${landInfo}
    Should Be Equal As Integers    ${rowCount}    3   ##there are three rows incldued column title
    Close Current Excel Document
    Remove File    ${filename}

Step ${step} User Clicks NAM To Check and Others Uncheck And Clicks
    #************************Step 13******************************
    #  Do:
    #      User clicks NAM to check and others uncheck and clicks
    #     download
    #  Expected:
    #      The file can download successfully
    #      Open the file and it has only one lane
    #************************************************************
    Click    xpath=//div//tr[td//text()[contains(.,"APAC")]]//input[@type='checkbox']
    Click    xpath=//div//tr[td//text()[contains(.,"NAM")]]//input[@type='checkbox']
    ${filename}    Download File    ${Project_RoundMgmt_Routing_Download}
    Open Excel Document     ${filename}    ${PROJECT.MODE}
    ${landInfo}    Read Excel Column    1    
    ${rowCount}    Get Length    ${landInfo}
    Should Be Equal As Integers    ${rowCount}    2   ##there are two rows incldued column title
    Close Current Excel Document
    Remove File    ${filename}

Step ${step} User Clicks Europe To Check and Others Uncheck And
    #************************Step 14******************************
    #  Do:
    #      User clicks Europe to check and others uncheck and
    #     clicks download
    #  Expected:
    #      The file can download successfully
    #      Open the file and it has only one lane
    #************************************************************
    Click    xpath=//div//tr[td//text()[contains(.,"NAM")]]//input[@type='checkbox']
    Click    xpath=//div//tr[td//text()[contains(.,"EUROPE")]]//input[@type='checkbox']
    ${filename}    Download File    ${Project_RoundMgmt_Routing_Download}
    Open Excel Document     ${filename}    ${PROJECT.MODE}
    ${landInfo}    Read Excel Column    1       
    ${rowCount}    Get Length    ${landInfo}
    Should Be Equal As Integers    ${rowCount}    2   ##there are two rows incldued column title
    Close Current Excel Document
    Remove File    ${filename}

Step ${step} User Clicks Setup Button
    #************************Step 15******************************
    #  Do:
    #      User clicks setup button
    #  Expected:
    #      A dialogue named routing confirmation setup appears
    #************************************************************
    Click    ${Project_RoundMgmt_Routing_Setup}
    Wait For Elements State    ${Project_RoundMgmt_Setup_Download}    visible    10

Step ${step} User Clicks Download Button
    #************************Step 16******************************
    #  Do:
    #      User clicks download button
    #  Expected:
    #      The file download successfully
    #      The name of the file likes that RoutingSetupFile
    #************************************************************
    ${filename}    Download File    ${Project_RoundMgmt_Setup_Download}
    Set Test Variable    ${filename}     ${filename} 

Step ${step} User Opens The Download File
    #************************Step 17******************************
    #  Do:
    #      User opens the download file
    #  Expected:
    #      There are two lanes in the file It has five columns
    #     Lane Id Origin CY RP ICD Port of Load POL Port of
    #     Discharge POD Destination CY RP ICD
    #      The detail you can see from the screenshot
    #      index php attachments get 3385b128 0d2e 4fd3 95eb
    #     2276875fde5b
    #************************************************************
    ${RoutingFileColumn}    Create List    Lane ID    Origin CY/RP/ICD    Port of Load(POL)    Port of Discharge(POD)    Destination CY/RP/ICD
    Set Suite Variable    ${ROUTING_FILE_COLUMN}    ${RoutingFileColumn}
    Open Excel Document     ${filename}    Sheet0
    ${titleList}    Read Excel Row    1
    Lists Should Be Equal    ${titleList}    ${ROUTING_FILE_COLUMN}    ignore_order=True
    ${laneInfo}    Read Excel Column    1       
    ${rowCount}    Get Length    ${laneInfo}
    Should Be Equal As Integers    ${rowCount}    3   ##there are two rows incldued column title
    Close Current Excel Document
    Open Excel Document     ${filename}    Sheet0

Step ${step} User Modifies The Value Of The File Some Columns Are
    #************************Step 18******************************
    #  Do:
    #      User modifies the value of the file Some columns are
    #     allowed and some are not allowed
    #  Expected:
    #      The file can modify successfully For example like below
    #      index php attachments get 44c38860 2c59 4431 9fc0
    #     2828432a8674
    #************************************************************
    Write Excel Cell    2    2    Not Allowed    Sheet0
    Write Excel Cell    2    3    Not Allowed    Sheet0
    Save Excel Document    ${filename}
    Close Current Excel Document
    Sleep    2

Step ${step} User Uploads The Modified File
    #************************Step 19******************************
    #  Do:
    #      User uploads the modified file
    #  Expected:
    #      There is a pop up dialogue telling you uploaded
    #     successfully
    #************************************************************
    Click    ${Project_RoundMgmt_Setup_Upload}
    Wait For Elements State    ${Project_RoundMgmt_Setup_UploadAddFile}    visible    60
    Wait For Elements State   ${Project_RoundMgmt_Setup_UploadAddFile}     enabled
    Upload File By Selector    ${upload_addFileButton}    ${filename}
    Wait Until Search Finished

Step ${step} User Clicks Ok Button Of The Pop up Dialogue
    #************************Step 20******************************
    #  Do:
    #      User clicks ok button of the pop up dialogue
    #  Expected:
    #      The pop up disappears
    #************************************************************
    Wait For Elements State    ${Project_RoundMgmt_Setup_UploadAddFile_OKButton}    visible    60
    Click    ${Project_RoundMgmt_Setup_UploadAddFile_OKButton}
    Remove File    ${filename}
    Sleep    2


Step ${step} User Clicks Setup Button And Download Button
    #************************Step 21******************************
    #  Do:
    #      User clicks setup button and download button
    #  Expected:
    #      A file download successfully
    #************************************************************
    Click    ${Project_RoundMgmt_Routing_Setup}
    ${filename}    Download File    ${Project_RoundMgmt_Setup_Download}
    Set Test Variable    ${filename}     ${filename}

Step ${step} User Opens The Download File 2
    #************************Step 22******************************
    #  Do:
    #      User opens the download file
    #  Expected:
    #      The value of the file is equal to the modified value
    #************************************************************
    Open Excel Document     ${filename}    Sheet0
    Check Cell Value    2    2    Not Allowed    Sheet0
    Check Cell Value    2    3    Not Allowed    Sheet0   
    Close All Excel Documents
    Remove File     ${filename}
    Click    ${Dialog_Close}
    Click    ${Dialog_Close}
    Mouse Move Relative To    css = .close[data-ng-click='$close()']
    Focus    css = .close[data-ng-click='$close()']
    Click    ${Dialog_Close}
    Sleep    1

Step ${step} User Start Round The Project Assignment Are As APAC
    #************************Step 23******************************
    #  Do:
    #     set deadline for each region: APAC->current date +5 day, Europe-->current date +5 day, NAM-->current date +5 day
    #     Set user assignee for each region: APAC->WENDJIAN, Europe-->NATZHANG, NAM-->ZLAWRENC
    #     Start round. Send notification.
    #  Expected:
    #      Round start successfully
    #************************************************************
    Wait For Elements State    //input[@id='regionAssignmet_Date_0_0']    visible    30
    ${Date}    Get Current Date    local    +5days    result_format=%d/%m/%Y
    Input Deadline In Region Tab    0    0    ${Date}
    Input Deadline In Region Tab    0    1    ${Date}
    Input Deadline In Region Tab    1    0    ${Date}
    Wait For Elements State    ${Project_RoundMgmt_AssignButton}    visible
    Wait Until Keyword Succeeds    5x    100ms    Click    ${Project_RoundMgmt_AssignButton}
    Wait For Elements State    ${Project_RoundMgmt_Assign_ApacTab}    visible    
    Click    xpath= //div[@data-model='selectedItems']
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_ApacTab}    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_EuropeTab}    xpath= //div[@class='tab-pane ng-scope active']//div[@class='tab-pane ng-scope active']//b[.='natural zhang (NATZHANG)']
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_NamTab}    xpath = //b[.='Snow Li (SNOWLI01)']
    Click    ${Project_RoundMgmt_Assign_SaveButton}
    Wait Until Search Finished
    Click    ${Project_RoundMgmt_StartButton}
    Wait Until Keyword Succeeds    10x    100ms    Click    ${Project_RoundMgmt_StartConfirmButton} 
    Wait Until Search Finished
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_Confirm_SendButton}
    Wait Until Search Finished
    Close Browser

Step ${step} Reopen The Dialog Exchange The Current Role To Regional
    #************************Step 24******************************
    #  Do:
    #      Reopen the dialog exchange the current role to Regional
    #     Pricing Manager APAC
    #  Expected:
    #      Role exchanged successfully
    #************************************************************
    Remove All Files
    Set Global Variable    ${USERNAME}    WENDJIAN
    Login Space
    Search Project    ${PROJECT.TENDER_ID}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    500ms    Click    ${Project_toolbar_RoundMgmtButton}
    Assign My Current Role    Regional Pricing Manager(APAC)

Step ${step} User Clicks Routing Confirmation Button 2
    #************************Step 25******************************
    #  Do:
    #      User clicks routing confirmation button
    #      Pop up window Routing Confirmation displayes
    #      Note Please only review the ports which have been
    #     marked in ORANGE All other ports can be updated by
    #     pricing lead only
    #      There are 2 lanes need your confirmation please
    #     download the list and upload it after confirming
    #      download Upload Cancel button
    #      Click Download button
    #  Expected:
    #      Download file successfully
    #************************************************************
    Click    ${Project_RoundMgmt_RoutConfirmButton}
    Wait For Elements State    //legend[.='There are 2 lanes need your confirmation, please download the list and upload it after confirming.']
    Wait For Elements State    ${Project_RoundMgmt_Confirm_Download}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_Upload}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_Cancel}

    ${filename}    Download File    ${Project_RoundMgmt_Confirm_Download}
    Set Test Variable    ${filename}    ${filename}
    Wait Until Search Finished

    Open Excel Document     ${filename}    FCL
    ${laneInfo}    Read Excel Column    1       
    ${rowCount}    Get Length    ${laneInfo}
    Should Be Equal As Integers    ${rowCount}    3   ##there are three rows incldued column title

Step ${step} The Value And Background Color Are As
    #************************Step 26******************************
    #  Do:
    #      The value and background color are as
    #      index php attachments get f05a137e 0403 4013 9f4e
    #     b4a05e38c62d
    #      Update the file as
    #      index php attachments get 6b14905b f89f 48ff 9adf
    #     cb10bf0c4cfc
    #  Expected:
    #      Uploaded Successfully is displayed
    #************************************************************
    Check Cell Value    2   11    CNSHA    FCL
    Check Cell Value    2   12    CNSHA    FCL
    Check Cell Value    2   13    USLAX    FCL
    Check Cell Value    2   14    USLAX    FCL
    Check Cell Value    3   11    DEHAM    FCL
    Check Cell Value    3   12    DEHAM    FCL
    Check Cell Value    3   13    AUSYD    FCL
    Check Cell Value    3   14    AUSYD    FCL
    Write Excel Cell    3   13    AUCNS    FCL
    Write Excel Cell    3   14    AUCNS    FCL
    Save Excel Document    ${filename}
    Close Current Excel Document
    Click     ${Project_RoundMgmt_Confirm_Upload}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_UploadAddFile}    visible    10
    Upload File By Selector    ${upload_addFileButton}    ${filename}
    Wait Until Search Finished
    Close Current Excel Document

Step ${step} Click On OK Button
    #************************Step 27******************************
    #  Do:
    #      Click on OK button
    #      Exchange current role to Project owner
    #      User clicks round button routing confirmation button
    #  Expected:
    #      The state of the APAC region is reviewed
    #************************************************************
    Wait For Elements State    ${Project_RoundMgmt_Setup_UploadAddFile_OKButton}    visible    60
    Click    ${Project_RoundMgmt_Setup_UploadAddFile_OKButton}
    Remove File   ${filename}
    Click    ${Dialog_Close}
    Sleep    1
    Assign My Current Role    Project Owner
    # Close Browser
    # Remove File    ${filename}
    # Set Global Variable    ${USERNAME}    AUTOTEST
    # Login Space
    # Search Project    ${PROJECT.TENDER_ID}
    # Wait Until Search Finished
    # Click    ${Project_toolbar_RoundMgmtButton}
    # Wait For Elements State    ${Project_RoundMgmt_RoutConfirmButton}     enabled    60
    Click    ${Project_RoundMgmt_RoutConfirmButton}
    Wait For Elements State   ${Project_RoundMgmt_Routing_Download}    enabled    60
    Get Element States     xpath=//div//tr[td//text()[contains(.,"APAC")]][td//text()[contains(.,"Reviewed")]]    contains    visible


Step ${step} Select APAC Click On Confirm Button And Approve Button
    #************************Step 28******************************
    #  Do:
    #      Select APAC click on confirm button and Approve button
    #  Expected:
    #      The state of the APAC region is Confirmed
    #************************************************************
    Click    xpath=//div//tr[td//text()[contains(.,"APAC")]]//input[@type='checkbox']
    Click    ${Project_RoundMgmt_Routing_Confirm}
    Wait For Elements State    ${Project_RoundMgmt_Routing_Confirm_Approve}    enabled    30
    Click    ${Project_RoundMgmt_Routing_Confirm_Approve}
    Wait For Elements State     //td[.="APAC"]/../td[.="Confirmed"]
    Wait Until Search Finished

Step ${step} Select APAC Click On Download Check The Downloaded File
    #************************Step 29******************************
    #  Do:
    #      Select APAC click on Download check the downloaded file
    #  Expected:
    #      index php attachments get 3452a065 559f 4cb0 9d10
    #     2d5d63aaa35e
    #************************************************************
    Click    xpath=//div//tr[td//text()[contains(.,"APAC")]]//input[@type='checkbox']
    Sleep    2
    ${filename}    Download File    ${Project_RoundMgmt_Routing_Download}
    Set Test Variable    ${filename}    ${filename}
    Wait Until Search Finished
    Open Excel Document     ${filename}    FCL
    Check Cell Value    2   11    CNSHA    FCL
    Check Cell Value    2   12    CNSHA    FCL
    Check Cell Value    2   13    USLAX    FCL
    Check Cell Value    2   14    USLAX    FCL
    Check Cell Value    3   11    DEHAM    FCL
    Check Cell Value    3   12    DEHAM    FCL
    Check Cell Value    3   13    AUSYD    FCL
    Check Cell Value    3   14    AUCNS    FCL

Step ${step} Close This Dialog In Round Management Page Download IPT
    #************************Step 30******************************
    #  Do:
    #      Close this dialog in round management page download IPT
    #     check the file
    #  Expected:
    #      index php attachments get 8aa2b6d5 60e6 4e8d 9825
    #     a2cbf1085870
    #************************************************************
    Click    ${Dialog_Close}
    Sleep    4
    ${filename}    Download File    ${Project_RoundMgmt_DownloadButton}
    Set Test Variable    ${filename}    ${filename}
    Wait Until Search Finished
    Open Excel Document     ${filename}    FCL_D
    Check Cell Value    6   81    AUCNS    FCL_D
    Check Cell Value    5   81    USLAX    FCL_D
    Check Cell Value    5   80    USLAX    FCL_D
    Check Cell Value    6   80    AUSYD    FCL_D
    Check Cell Value    5   79    CNSHA    FCL_D
    Check Cell Value    6   79    DEHAM    FCL_D
    Check Cell Value    5   78    CNSHA    FCL_D
    Check Cell Value    6   78    DEHAM    FCL_D
    Check Cell Value    5   77    DR    FCL_D
    Check Cell Value    6   77    RP    FCL_D
    Check Cell Value    5   82    CY    FCL_D
    Check Cell Value    6   82    DR    FCL_D
    Close All Excel Documents


Step ${step} Login As NATZHANG Open This Project Round Management
    #************************Step 31******************************
    #  Do:
    #      Login as NATZHANG Open this project round management
    #     change the role to Regional Pricing Manager EUROPE click
    #     on Routing Confirmation download file
    #  Expected:
    #      index php attachments get c04e0afa 5f36 4c88 80a0
    #     b1163fa5ae73
    #************************************************************
    Set Global Variable    ${USERNAME}    NATZHANG
    Login Space
    Search Project    ${PROJECT.TENDER_ID}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    500ms    Click    ${Project_toolbar_RoundMgmtButton}
    Sleep    2
    Assign My Current Role    Regional Pricing Manager(EUROPE)
    Click    ${Project_RoundMgmt_RoutConfirmButton}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_Download}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_Upload}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_Cancel}
    ${filename}    Download File    ${Project_RoundMgmt_Confirm_Download}
    Set Test Variable    ${filename}    ${filename}
    Wait Until Search Finished
    Open Excel Document     ${filename}    FCL
    Check Cell Value    2   11    DEHAM    FCL
    Check Cell Value    2   12    DEHAM    FCL
    Check Cell Value    2   13    AUSYD    FCL
    Check Cell Value    2   14    AUCNS    FCL

Step ${step} Modify It As
    #************************Step 32******************************
    #  Do:
    #      Modify it as
    #      index php attachments get 4a5171ee e97b 49a8 b951
    #     00c6e3d73764
    #      Upload it
    #  Expected:
    #      Uploaded Successfully is displayed
    #************************************************************
    Write Excel Cell    2   11    DEBRV    FCL
    Write Excel Cell    2   12    DEBRV    FCL
    Write Excel Cell    2   13    AUCNS    FCL
    Write Excel Cell    2   14    AUCNS    FCL
    Save Excel Document    ${filename}
    Close Current Excel Document
    Click     ${Project_RoundMgmt_Confirm_Upload}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_UploadAddFile}    visible    10
    Upload File By Selector    ${upload_addFileButton}    ${filename}
    Wait Until Search Finished
    Wait For Elements State    ${Project_RoundMgmt_Setup_UploadAddFile_OKButton}    visible    60
    Click    ${Project_RoundMgmt_Setup_UploadAddFile_OKButton}
    Close Current Excel Document
 
Step ${step} Login As WENDJIAN Again Open This Project Round
    #************************Step 33******************************
    #  Do:
    #      Login as WENDJIAN again Open this project round
    #     management dialog click on Routing Confirmation
    #      Select EUROPE click on Confirm button
    #      In the pop up window click on Reject button
    #  Expected:
    #      The state of EUROPE is Rejected
    #*************************************************************
    Remove File   ${filename}
    Close Browser
    Set Global Variable    ${USERNAME}    WENDJIAN
    Login Space
    Search Project    ${PROJECT.TENDER_ID}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    500ms    Click    ${Project_toolbar_RoundMgmtButton}
    Wait Until Keyword Succeeds    5x    100ms    Click    ${Project_RoundMgmt_RoutConfirmButton} 
    Click    xpath=//div//tr[td//text()[contains(.,"EUROPE")]]//input[@type='checkbox']
    Click    ${Project_RoundMgmt_Routing_Confirm}
    Wait For Elements State    ${Project_RoundMgmt_Routing_Confirm_Reject}    enabled    30
    Click    ${Project_RoundMgmt_Routing_Confirm_Reject}
    Wait For Elements State     //td[.="EUROPE"]/../td[.="Rejected"]
    Wait Until Search Finished

Step ${step} Close This Window In Round Management Download IPT
    #************************Step 34******************************
    #  Do:
    #      Close this window in round management download IPT
    #  Expected:
    #      index php attachments get dbc2ecf5 635c 42e4 8593
    #     d08eb12b36e1
    #************************************************************
    Click    ${Dialog_Close}
    ${filename}    Download File    ${Project_RoundMgmt_DownloadButton}
    Set Test Variable    ${filename}    ${filename}
    Wait Until Search Finished

    Open Excel Document     ${filename}    FCL_D
    Check Cell Value    6   81    AUCNS    FCL_D
    Check Cell Value    5   81    USLAX    FCL_D
    Check Cell Value    5   80    USLAX    FCL_D
    Check Cell Value    6   80    AUSYD    FCL_D
    Check Cell Value    5   79    CNSHA    FCL_D
    Check Cell Value    6   79    DEHAM    FCL_D
    Check Cell Value    5   78    CNSHA    FCL_D
    Check Cell Value    6   78    DEHAM    FCL_D
    Check Cell Value    5   77    DR    FCL_D
    Check Cell Value    6   77    RP    FCL_D
    Check Cell Value    5   82    CY    FCL_D
    Check Cell Value    6   82    DR    FCL_D
    Close Current Excel Document

Step ${step} Click On Close Button
    #************************Step 35******************************
    #  Do:
    #      Click on Close button
    #      In Pricing Project page User selects TenderID Contains
    #     20240815
    #  Expected:
    #      The project could be found
    #************************************************************
    Remove File    ${filename}
    Remove All Files
    close browser
    Set Global Variable    ${USERNAME}    AUTOTEST
    Login Space
    Search Project    ${PROJECT.TENDER_ID}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    500ms    Click    ${Project_toolbar_RoundMgmtButton}
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_CloseRoundButton}
    click    ${Project_RoundMgmt_StartConfirmButton}
    Click    ${Project_RoundMgmt_CloseButton}
    Search Project    ${PROJECT.TENDER_ID}
    Click DataClean For Delete
    Log    Done in teardown


Step ${step} Select This Project Click On Delete Project Button
    #************************Step 36******************************
    #  Do:
    #      Select this project click on Delete Project button
    #      Click Yes of the pop up confirm window
    #  Expected:
    #      System displays Project has been deleted
    #************************************************************
    Log    Done in teardown

Step ${step} User Goes To Basic Data Management Tender List 2
    #************************Step 37******************************
    #  Do:
    #      User goes to Basic Data Management Tender List
    #      Search out the tender created in step1
    #      Click on Delete button
    #      Click on Yes button in the popup dialog
    #  Expected:
    #      System displays Tender has been deleted
    #************************************************************
    Log    Done in teardown


